<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button style="width: 100px; height: 30px; font-size: 18px;" onclick="send_msg()">发送消息</button>
</body>
<script>

    function send_msg() {
        ws = new WebSocket("ws://127.0.0.1:65510");
        ws.onopen=function (e) {
            if(ws.readyState === 1){
                var message = {"data":"okkkkkkkkkkk","gateway_id":2};
                ws.send(JSON.stringify(message));
            }
        };
    }

</script>
</html>